define(function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function(params) {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                   
                    
                    shop_list:[],
                    building:[],
                    rooms:[]
                   
                };
            },
            el: "#pageGetOutRoomId",
            created: function created() {
                // this.getRoomInfo();
                // this.getUserInfo();
                this.getShopList();
            },

            mounted: function mounted() {
                    if (this.mounted == 1) {
                        return;
                    }
                    
                     
            },
            methods: {
                  getShopList:function(){
                    var that = this;   
                    app.get("mall/shop/get", {
                      type:'tenement',
                    }, function (res) {
                      if (res.code != 200) {
                         app.alert(res.msg);
                         return ;
                      }                     
                      that.shop_list=res.data.list;  
                       
                    });
                },
                getBuilding:function(){
                   var that = this;   
                    app.get("api/community_rooms/getBuilding", {
                      community_id:$("#shop_id").val(),
                    }, function (res) {
                      if (res.code != 200) {
                         app.alert(res.msg);
                         return ;
                      }                     
                      that.building=res.data;  
                       
                    });
                },
                getRooms:function(){
                   var that = this;   
                    app.get("api/community_rooms/get", {
                      community_id:$("#shop_id").val(),
                      building_key:$("#building_key").val(),
                    }, function (res) {
                      if (res.code != 200) {
                         app.alert(res.msg);
                         return ;
                      }                     
                      that.rooms=res.data.list;  
                       
                    });
                },
                getOutRoomId:function(){
                  var outRoomId = $("#outRoomId").val();
                  if(!outRoomId){
                     app.alert("请先选择房屋");
                     return ;
                  }
                   this.$router.push({
                                    name: "bills",
                                    params: {
                                        out_room_id: outRoomId,
                                        community_id: $("#shop_id").val(),    
                                    }
                                });
                },

                setData:function(data){
                     for(var i in data){
                        this[i]=data[i];
                     }
                  },
                   
              }
        }).$mount("#app");
    };
    controller.pageShow = function() {};
    module.exports = controller;
});
